<template>
  <div style="padding: 15px">
    <div style="margin-bottom: 15px;">
      <Input style="width: 200px;" placeholder="请输身份名称"/>
      <Button type="success">搜索</Button>
      <Button @click="add" type="primary" style="float: right;">添加等级</Button>
    </div>
    <Table border :columns="columns7" :data="data6"></Table>
    <Page :total="100" show-elevator />
    <Modal v-model="identity" title="添加等级" :width="750" :mask-closable="false">
      <Form :model="addForm" :label-width="80">
        <FormItem label="身份名称">
          <Input v-model="addForm.addName" placeholder="请输入身份名称" />
        </FormItem>
        <FormItem label="名称描述">
          <Input v-model="addForm.addRemark" type="textarea" :autosize="{minRows: 2,maxRows: 3}" placeholder="名称描述"/>
        </FormItem>
        <FormItem label="设置禁启">
          <i-switch size="large" v-model="addForm.addStatus">
            <span slot="open">启用</span>
            <span slot="close">禁用</span>
          </i-switch>
        </FormItem>
      </Form>
    </Modal>
  </div>
</template>

<script>
  export default {
    name: 'readerIdentity',
    data () {
      return {
        identity: false,
        addForm: {},
        columns7: [
          {
            title: '身份编号',
            align: 'center',
            tooltip: true,
            key: 'name'
          },
          {
            title: '身份名称',
            align: 'center',
            tooltip: true,
            key: 'age'
          },
          {
            title: '身份描述',
            align: 'center',
            tooltip: true,
            key: 'address'
          },
          {
            title: '添加时间',
            align: 'center',
            tooltip: true,
            key: 'address'
          },
          {
            title: '添加人',
            align: 'center',
            tooltip: true,
            key: 'address'
          },
          {
            title: '更新时间',
            align: 'center',
            tooltip: true,
            key: 'address'
          },
          {
            title: '更改人',
            align: 'center',
            tooltip: true,
            key: 'address'
          },
          {
            title: '状态',
            align: 'center',
            render: (h, params) => {
              const row = params.row
              const color = row.status === '1' ? 'primary' : row.status === '0' ? 'error' : ''
              const text = row.status === '1' ? '正常' : row.status === '0' ? '禁用' : ''
              return h('Tag', {
                props: {
                  type: 'dot',
                  color: color
                }
              }, text)
            }
          },
          {
            title: '操作',
            key: 'action',
            width: 150,
            align: 'center',
            render: (h, params) => {
              return h('div', [
                h('Button', {
                  props: {
                    type: 'primary',
                    size: 'small'
                  },
                  style: {
                    marginRight: '5px'
                  },
                  on: {
                    click: () => {
                    }
                  }
                }, '编辑'),
                h('Button', {
                  props: {
                    type: 'error',
                    size: 'small'
                  },
                  on: {
                    click: () => {
                      this.$Modal.confirm({
                        title: '你确定删除该标签吗？',
                        okText: '确定',
                        cancelText: '取消',
                        onOk: () => {
                        }
                      })
                    }
                  }
                }, '删除')
              ])
            }
          }
        ],
        data6: [
          {
            name: 'John Brown',
            age: 18,
            address: 'New York No. 1 Lake Park',
            topTeacher: '1'
          },
          {
            name: 'Jim Green',
            age: 24,
            address: 'London No. 1 Lake Park',
            topTeacher: '1'
          },
          {
            name: 'Joe Black',
            age: 30,
            address: 'Sydney No. 1 Lake Park',
            topTeacher: '0'
          },
          {
            name: 'Jon Snow',
            age: 26,
            address: 'Ottawa No. 2 Lake Park',
            topTeacher: '1'
          }
        ]
      }
    },
    methods: {
      add() {
        this.identity = true
      }
    }
  }
</script>

<style scoped>

</style>
